# cythonize -i -a test.pyx
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
import os
pyxNames = ['test.pyx', 'ccommon.pyx']
extensions = [
        Extension("test", ['test.pyx', 'libs/cpp/Rectangle.cpp'],
            include_dirs=['libs/cpp'],
            #libraries=[...],
            #library_dirs=[...]
            ),
        Extension("ccommon", ['ccommon.pyx'],
            #include_dirs=['.'],
            #libraries=[...],
            #library_dirs=[...]
            )
        ]
setup(
        name='my app',
        ext_modules= cythonize(extensions, language='c++', annotate=True)
    )

for pyxName in pyxNames:
    name = os.path.basename(pyxName)
    dirPath = os.path.dirname(pyxName)
    name2 = os.path.splitext(name)[0]
    if os.path.exists(os.path.join(dirPath, name2+'.c')):
        os.unlink(os.path.join(dirPath, name2+'.c'))
    if os.path.exists(os.path.join(dirPath, name2+'.cpp')):
        os.unlink(os.path.join(dirPath, name2+'.cpp'))
